package com.wjy.rbac.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wjy.rbac.entity.PowerRequestUrl;
import com.wjy.rbac.mapper.PowerRequestUrlMapper;
import com.wjy.rbac.service.IPowerRequestUrlService;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author ybxxszl
 * @since 2019-04-12
 */
@Service
public class PowerRequestUrlServiceImpl extends ServiceImpl<PowerRequestUrlMapper, PowerRequestUrl>
        implements IPowerRequestUrlService {

    @Override
    public void insert(PowerRequestUrl powerRequestUrl) {
        save(powerRequestUrl);
    }

    @Override
    public void update(PowerRequestUrl powerRequestUrl) {
        updateById(powerRequestUrl);
    }

    @Override
    public void delete(String powerRequestUrlId) {
        removeById(powerRequestUrlId);
    }

    @Override
    public Map<String, Object> get(String powerRequestUrlId) {
        Map<String, Object> result = new HashMap<String, Object>();
        PowerRequestUrl powerRequestUrl = getById(powerRequestUrlId);
        result.put("powerRequestUrl", powerRequestUrl);
        return result;
    }

    @Override
    public List<PowerRequestUrl> getByPowerId(String powerId) {
        Map<String, Object> columnMap = new HashMap<String, Object>();
        columnMap.put(PowerRequestUrl.POWER_ID, powerId);
        List<PowerRequestUrl> powerRequestUrlList = (List<PowerRequestUrl>) listByMap(columnMap);
        return powerRequestUrlList;
    }

}
